#ifndef GlobalsH
#define GlobalsH

  #define CheckMSG() Application->ProcessMessages()

  #define _free( x ) if ( x ) { free( x ); x = NULL; }
  #define WGET(x, y) *(WORD *)&x[y]
  #define LGET(x, y) *(LONG *)&x[y]
  #define GET24(x, y) ( *(LONG *)&x[y] & 0x00FFFFFF )

  #define LRAM( x ) *(LONG *)&ram[ x ]
  #define WRAM( x ) *(WORD *)&ram[ x ]


  #include <vcl.h>
  #include <stdio.h>
  #include <conio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <dir.h>
  #include <ctype.h>


  typedef struct _VMS
  { //
    LONG spIndex;
    LONG BaseOffset;
    LONG Start;
    LONG End;
    WORD curIndex;
    WORD opCode;
    BYTE *Pointer;
    BYTE *LabelRef;
  } TVMS;

  typedef struct _REGZ
  { //
    WORD x;
    WORD y;
    WORD a;
    BYTE stack;
  } TREG;

  typedef struct TROMDATA
  {
    LONG Length;
    LONG Header;
    BYTE *data;
    bool Modified;
  } TROM;

  typedef struct TTABLEDATA
  {
    char sngl[0x00100][16];
    char dual[0x10000][16];
  } TTBL;


  extern char dirc[512];
  extern char txtf[512];
  extern char romf[512];
  extern char tblf[512];  
  extern char cur_dir[MAXPATH];
  extern bool inTextShow;
  //
  extern BYTE *ram;
  extern TROM rom;
  extern TREG reg;
  extern TVMS vms;
  extern TTBL tbl;

  extern char *moves[8];

  extern LONG GetIndex( char *strg );
  extern void Dec2Bin( BYTE *string, LONG valu, BYTE size );
  extern long Snes2Pc( long ofs );
  extern long FileSize( FILE *tf );

  #include "Script_Main.h"

#endif
